package com.wyl.mine.message

import androidx.databinding.ObservableField
import com.wuhenzhizao.titlebar.widget.CommonTitleBar
import com.wyl.base.bean.MsgData
import com.wyl.libbase.base.BindingActivity
import com.wyl.libbase.extend.autoWired
import com.wyl.mine.R
import com.wyl.mine.databinding.MessageDetailActivityBinding

class MessageDetailActivity : BindingActivity<MessageDetailActivityBinding>() {
    val title = ObservableField<String>()
    val content by lazy { ObservableField<String>(getString(R.string.ui_loading)) }

    override fun getLayoutId(): Int = R.layout.message_detail_activity

    override fun initView() {
        binding.vm = this

        binding.titlebar.setListener { _, action, _ ->
            when (action) {
                CommonTitleBar.ACTION_LEFT_BUTTON -> onBackPressed()
                else -> {
                }
            }
        }
    }

    override fun loadData() {
        val data: MsgData? = autoWired("mUserData", null)
        data?.let {
            title.set(it.title)
            content.set(it.content)
        }
    }

}
